package org.jason.model.article.es;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jason.model.interaction.es.ArticleComment;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Document(indexName = "article_content")
@ApiModel(value = "ArticleContent对象", description = "文章正文表")
public class ArticleContent implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "文章id")
    @Id
    private Integer id;

    @ApiModelProperty(value = "文章标题")
    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String title;

    @ApiModelProperty(value = "文章正文")
    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String content;

    @ApiModelProperty(value = "作者id")
    @Field(type = FieldType.Keyword)
    private Integer authorId;

    @ApiModelProperty(value = "作者昵称")
    @Field(type = FieldType.Keyword)
    private String authorNickname;

    @ApiModelProperty(value = "标签(标识文章话题)")
    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String tag;

    @ApiModelProperty(value = "评论表")
    @Field(type = FieldType.Nested)
    private List<ArticleComment> commentList;
}
